package com.example.Android_test.util;

import android.content.Context;
import android.util.Log;
import android.view.View;
import android.view.animation.Animation;
import com.example.Android_test.R;
import com.example.Android_test.activity.Main;

/**
 * Created with IntelliJ IDEA.
 * User: anpi0413
 * Date: 06.06.13
 * Time: 16:25
 * To change this template use File | Settings | File Templates.
 */
public class ReadyAnimations {
   // public static final int ANIMATE_FADE_OUT = R.anim.fade_out;
    public static final int ANIMATE_FADE_OUT = R.anim.anim_button_variant_change;
    public static final int ANIMATE_ROTATE_FLIPFLOP = R.anim.anim_shake;
    public static final int ANIMATE_RIGHT_GO_GO = R.anim.anim_button_right_gogo;

    public static void animateView(Context context, View view, int anim) {
        animateViewWithDelay(context, view, anim, 0);
    }

    public static void animateViewWithDelay(Context context, View view, int anim, int delay) {
        try {
            Animation animation = android.view.animation.AnimationUtils.loadAnimation(context, anim);
            animation.setStartOffset(delay);
            view.startAnimation( animation );
        } catch (Exception e) {
            Log.w(Main.LOG_TAG, "Animation not found " + anim);
        }
    }
}
